package com.example.systemserver.config;

import com.example.systemserver.Bean.ResultBean;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionAdvice {

    @ExceptionHandler(MyException.class)
    public ResultBean handleException(RuntimeException e) {
        return
                new ResultBean(500, e.getMessage(), null);
    }

    @ExceptionHandler(Exception.class)
    public ResultBean handleException(Exception e) {
        return new ResultBean(500, "对不起，您的网络有问题", null);
    }
}
